#include "fxcc/yml/Serializer.h"
#include "fxcc/core/Base.h"

using namespace fxcc::yml;

template <>
void Serializer::Encode<fxcc::Base>(YAML::Node& node, const fxcc::Base& inst)
{
    SetVariable<int>(node, "imguiFlag", inst.m_ImguiFlag);
    SetVariable<std::string>(node, "m_UUID", inst.m_UUID);
    //SetVariable<bool>(node, "selected", inst.m_Selected);
    SetVariable<bool>(node, "m_HasTreeNodedRender", inst.m_HasTreeNodedRender);
    SetVariable<float>(node, "m_ScrollY", inst.m_ScrollY);
    SetVariable<bool>(node, "m_TreeNode", inst.m_TreeNode);
    SetVariable<glm::vec2>(node, "m_NodePos", inst.m_NodePos);
    SetVariable<int>(node, "m_NodeId", inst.m_NodeId);


};

template <>
bool Serializer::Decode<fxcc::Base>(const YAML::Node& node, fxcc::Base& inst)
{
    GetVariable<int>(node, "imguiFlag", inst.m_ImguiFlag);
    GetVariable<std::string>(node, "m_UUID", inst.m_UUID);
    //GetVariable<bool>(node, "selected", inst.m_Selected);
    GetVariable<bool>(node, "m_HasTreeNodedRender", inst.m_HasTreeNodedRender);
    GetVariable<float>(node, "m_ScrollY", inst.m_ScrollY);
    GetVariable<bool>(node, "m_TreeNode", inst.m_TreeNode);
    GetVariable<glm::vec2>(node, "m_NodePos", inst.m_NodePos);
    GetVariable<int>(node, "m_NodeId", inst.m_NodeId);

    return true;
}